﻿#pragma once

#include "common_data.h"

enum class RunState {
	robot_state_unknow = 0,
	robot_state_normal = 1,
	robot_state_pause = 2,
	robot_state_stop = 3,

	robot_state_max,
};

struct RobotInfo {
	bool connected;
	RunState run;
	QString joints;
	QString target;
	bool moving;
	int toolid;
	int faultcode;
	QString faultMsg;
	QString diInfo;
	QString doinfo;
};



json_struct(SetDOParam,
	mapping(int, index);
mapping(int, val);
prop(&index, &val);
)

json_struct(GripParam,
	mapping(int, index);
prop(&index);
)
json_struct(MoveJLInfoJ,
	mapping(int, id);
	mapping(QString, name);
	mapping(int, type);
	mapping(PositionJ, pos);
	mapping(int, vel);
	mapping(int, zone);
	mapping(int, acc);
	prop(&id,&name, &type, &pos, &vel, &zone, &acc);
);

struct MoveJLInfo {
	QString name;
	int id;
	int pointType; // 点类型：1：关节点 2：直线点 
	Position pos;
	int vel;  // 速度
	int zone;  // 圆滑距离
	int acc;   // 加速度
	int di;		// 停止di(默认-1)
	void TransFromMoveJLInfoJ(const MoveJLInfoJ& in)
	{
		id = in.id();
		name = in.name();
		pointType = in.type();
		pos.TransFromPositonJ(in.pos());
		vel = in.vel();
		acc = in.acc();
		zone = in.zone();
		di = -1;
	}
};

json_struct(Joints,
	mapping(float, joint1);
	mapping(float, joint2);
	mapping(float, joint3);
	mapping(float, joint4);
	mapping(float, joint5);
	mapping(float, joint6);
	prop(&joint1, &joint2, &joint3, &joint4, &joint5, &joint6);
	)

